import React from 'react';
import { Checkbox, Select } from 'antd';

export default () => {
    const { Option } = Select;
    const str = '江边,重要商圈,花园,';
    console.log(str.split(','));
    const s = "china,USA,";
    const a = s.split(",");
    a.splice(a.length-1, a.length);
    console.log(a);
    function handleChange(value) {
    console.log(value);
    }
    const change1 = (value) => {
        console.log(value);
    }
    return (
        <>
        <Checkbox.Group onChange={change1} defaultValue={str.split(',')}>
            <Checkbox value="江边">江边</Checkbox>
            <Checkbox value="景区">景区</Checkbox>
            <Checkbox value="宗教寺庙">宗教寺庙</Checkbox>
            <Checkbox value="重要商圈">重要商圈</Checkbox>
            <Checkbox value="医院">医院</Checkbox>
            <Checkbox value="学校">学校</Checkbox>
            <Checkbox value="大型市场">大型市场</Checkbox>
            <Checkbox value="均不是">均不是</Checkbox>
        </Checkbox.Group>
        <Select
        mode="multiple"
        style={{ width: '100%' }}
        placeholder="select one country"
        defaultValue={a}
        onChange={handleChange}
        optionLabelProp="label"
        >
        <Option value="china" label="China">
          <div className="demo-option-label-item">
            China (中国)
          </div>
        </Option>
        <Option value="usa" label="USA">
          <div className="demo-option-label-item">
            <span role="img" aria-label="USA">
              🇺🇸
            </span>
            USA (美国)
          </div>
        </Option>
        <Option value="japan" label="Japan">
          <div className="demo-option-label-item">
            <span role="img" aria-label="Japan">
              🇯🇵
            </span>
            Japan (日本)
          </div>
        </Option>
        <Option value="korea" label="Korea">
          <div className="demo-option-label-item">
            <span role="img" aria-label="Korea">
              🇰🇷
            </span>
            Korea (韩国)
          </div>
        </Option>
        </Select>
        </>
    )
}